#include "insert_sort.h"
#include "random_number_generator.h"
#include "gtest/gtest.h"

using namespace std;

class InsertSortTest : public testing::Test
{
public:
    void SetUp()
    {
    }

    void TearDown()
    {
    }
};

TEST_F(InsertSortTest, test)
{
    int* array = NULL;
    size_t len = 30000;

    RandomNumberGenerator::Generate(array, len);
    for ( size_t i = 0; i < len; ++i )
    {
        //cout << array[i] << endl;
    }

    insert_sort(array, len);
    //cout << "=============" << endl;

    for ( size_t i = 0; i < len; ++i )
    {
        //cout << array[i] << endl;
    }

    for ( size_t i = 1; i < len; ++i )
    {
        ASSERT_LE(array[i - 1], array[i]);
    }

    RandomNumberGenerator::Free(array);
}
